<!--
<template>
  <a-card :bordered="false">
    <div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">
      <a-alert type="info" :showIcon="true">
        <div slot="message">
          当前选择：<span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
          <a v-if="this.currSelected.title" style="margin-left: 10px" @click="onClearClsSelected">取消选择</a>
        </div>
      </a-alert>
      <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入分类名称"/>
      &lt;!&ndash; 树&ndash;&gt;
      <template v-if="clsTree[0].children.length>0">
        &lt;!&ndash;预警分类&ndash;&gt;
        <a-tree
          showLine
          default-expand-all
          :selectedKeys="selectedKeys"
          :checkStrictly="true"
          @select="onSelect"
          :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
          :treeData="clsTree"
        />
      </template>
      <div style="margin-top: 24px;" v-else-if="clsTree[0].children.length==0">
        <h3><span>无权限查看</span></h3>
      </div>
    </div>
  </a-card>
</template>

<script>

  import {getAction} from "../../../../api/manage";

  export default {
    name: 'getMajorTree',
    data(){
      return{
        clsName:'',
        url: {
          getMajorTree:"/InterviewQuestionBank/interviewQuestionBank/getMajorTree"
        },
        selectedKeys:[],
        currSelected:{},
        getMajorTree:[{key:'0',title:'面试题库',children:[]}]
      }
    },
    methods:{
      loadTree() {
        //{clsName:this.clsName,sysOrgCode:user.orgCode}
        var user=this.$store.getters.userInfo;//获取当前登录用户信息
        getAction(this.url.getMajorTree,{}).then((res)=>{
          if (res.success) {
            this.clsTree[0].children=res.result
          }
          else {
            this.clsTree[0].children=[]
            this.$message.warning(res.message)
          }
        })
      },
      getCurrSelectedTitle() {
        return !this.currSelected.title ? '' : this.currSelected.title
      },
      onSearch(val){
        this.clsName=val
        this.loadTree()
      },
      onSelect(selectedKeys, e){
        if (this.selectedKeys[0] !== selectedKeys[0]) {
          this.selectedKeys = [selectedKeys[0]];
        }
        let record = e.node.dataRef
        this.currSelected = Object.assign({}, record)
        this.$emit('selectCls',this.currSelected.key);
      },
      onClearClsSelected(){
        this.currSelected={}
        this.selectedKeys = []
        this.$emit('selectCls',this.currSelected.key);
      }
    },
    mounted() {
      this.loadTree();
    }
  }
</script>

<style scoped>
  @import '~@assets/less/common.less';
</style>-->
